home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group96a.txt
/
000124_icon-group-sender _Sat Jun 8 15:50:25 1996.msg
< prev
next >
Wrap
Internet Message Format
|
1996-09-05
|
2KB
Received: by cheltenham.cs.arizona.edu; Mon, 10 Jun 1996 07:59:41 MST
To: icon-group@cs.arizona.edu
Date: 8 Jun 1996 15:50:25 -0700
From: dave@cs.arizona.edu (Dave Schaumann)
Message-Id: <4pd03h$g3o@lectura.CS.Arizona.EDU>
Organization: University of Arizona CS Department, Tucson AZ
Sender: icon-group-request@cs.arizona.edu
References: <199606071540.LAA18004@morgoth>, <4pa3hq$lpc@labrador.cs.purdue.edu>
Subject: Re: m3 should have SWAP(a,b)
Errors-To: icon-group-errors@cs.arizona.edu
Status: O
In article <4pa3hq$lpc@labrador.cs.purdue.edu>,
Norman Ramsey <nr@cs.purdue.edu> wrote:
>In article <199606071540.LAA18004@morgoth>,
>Warren Smith <wds@research.nj.nec.com> wrote:
> >R.W.Floyd pointed out the desirability of
> > a <--> b
> >and
> > (a,b,c) <-- (f,g,h)
> >swap and simultaneous assignment - primitives in his Turing
> >award lecture about 20 years ago, but so far as I know, the SWAP
> >recommendation has not been provided in a common language
> >since then.
>
>Icon has swap, notated :=:
As you say. For my part, the only time I've found 'swap' to be a useful
operation is when I am writing sort algorithm (or sort-related algorithms,
like heap manipulation). Since (in my experience, anyway) this is not a
frequent occurrance, it doesn't seem like the best idea in the world to
include 'swap' as part of any language's basic repetoir of operations.
Perhaps others have found a more extensive use for swapping?
>I've wished for multiple assignment many times but have never seen it
>outside of the LISP family, where it masquerades as `let'.
What about Icon?
record Foo(first, second, third)
fghFoo := Foo(f, g, h)
abcFoo := copy(fghFoo)
Some observations:
1. No, in the most literal sense, this is not 'mulitple
assignment', but
2. It accomplishes the same thing, and
3. If three variables are closely related enough to
group in a multiple assignment, don't they belong in
a Record anyway?
4. The example extends to any language that supports
record assignment by copying.
-Dave